package com.youkeda.yunmusic.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

//@RestController  类中所有方法都返回JSON字符串
//@Controller  类中需要返回JSON字符串的方法在方法上加@ResponseBody

@Controller
public class SongControl {

    @RequestMapping(path="/song")
    public String getSong(@RequestParam(name="id",required=false) String id){
        if(id==null){
            id="1";
        }
        if(id.equals("1")){
            return "1";
        }else{
            return "other";
        }

    }
}
